package com.example.mobile2030606148tdh0427h;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class PakingRVAdapter extends RecyclerView.Adapter<PakingRVAdapter.ViewHolder> {
    private List<Paking>list;
    public  PakingRVAdapter(List<Paking>list){
        this.list=list;
    }
    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_rv_main_paking,parent,false);
return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Paking paking=list.get(position);
holder.tvname.setText(paking.getName());
holder.tvkongwei.setText(paking.getKongwei());
holder.tvmoney.setText(paking.getMoney());
holder.tvjuli.setText(paking.getJuli());
holder.tvdizhi.setText(paking.getDizhi());
    }

    @Override
    public int getItemCount() {
       return list.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder{
        ImageView imageView4;
        TextView tvname,tvkongwei,tvmoney,tvjuli,tvdizhi;
        public ViewHolder(@NonNull View itemView){
            super(itemView);
            tvname=itemView.findViewById(R.id.tv_main_name);
            tvkongwei=itemView.findViewById(R.id.tv_main_kongwei);
            tvmoney=itemView.findViewById(R.id.tv_main_money);
            tvjuli=itemView.findViewById(R.id.tv_main_juli);
            tvdizhi=itemView.findViewById(R.id.tv_main_dizhi);
        }

    }
}
